package com.hqyj.lyf.service.impl;

import com.hqyj.lyf.mapper.SubjectMapper;
import com.hqyj.lyf.pojo.Subject;
import com.hqyj.lyf.service.SubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Qiuluoer
 * @date 2022/5/28 11:50
 */
@Service
public class SubjectServiceImpl implements SubjectService {

    @Autowired
    private SubjectMapper subjectMapper;
    private static List list;
    @Override
    public List<Subject> queryAllSubject() {

            list = subjectMapper.selectList(null);

        return list;
    }

    @Override
    public String addSubject(Subject subject) {

        int insert = subjectMapper.insert(subject);
        if (insert < 0){
            System.out.println("添加失败");
        }
        return "添加成功";
    }
}
